package com.service;
import java.io.PrintWriter;
import java.util.List;

import org.apache.struts2.ServletActionContext;

import com.dao.BaseDao;

public class userService<T> {
		private BaseDao dao;
	
		public void AddUser(T user) throws Exception{
			dao.addObject(user);
		}
		
		public T SelectUser(String pnumber) throws Exception{
			if(pnumber == null) return null;
			String queryString = "FROM User user WHERE user.pnumber = '"+pnumber +"'";
			List<T> user = dao.getObjects(queryString);
			return user.get(0);
		}
		
		public void UpdateUser(T user) throws Exception{
			dao.updateObject(user);
		}
		public BaseDao getDao() {
			return dao;
		}

		public void setDao(BaseDao dao) {
			this.dao = dao;
		}
}
